package com.zzl.admin.config.redis;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
 * description: redis监听配置类
 * @author 朱正磊
 * @date 2022-02-07 13:41:23
 */
@Configuration
public class RedisConfig {

    /**
     * description: 手动注册redis监听到IOC
     * @author 朱正磊
     * @date 2022-02-07 14:38:33
     * @param redisConnectionFactory redis连接工厂
     * @return 返回redis消息监听器
     */
    @Bean
    public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory redisConnectionFactory) {
        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
        container.setConnectionFactory(redisConnectionFactory);
        return container;
    }

}
